package com.baseweb.webadmin.core.constants;

import java.util.ArrayList;
import java.util.List;

public enum ExampleType {
    ALBUM(1,"作品相册"), VIDEO(2,"作品视频"), CASE(3,"作品案例");

    private int code;
    private String name;
    ExampleType(int code, String name){
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static List<ExampleType> getAllData(){
        List<ExampleType> result = new ArrayList<ExampleType>();
        for (ExampleType current : ExampleType.values())
        {
            result.add(current);
        }
        return result;
    }

    public static ExampleType getNameByCode(int code){
        List<ExampleType> allData = getAllData();
        for (ExampleType status : allData){
            if (status.getCode() == code){
                return status;
            }
        }
        return null;
    }

//    public static void main(String[] args) {
//        for(ChannelType c : getAllChannel()){
//            System.out.print(c.getName());
//        }
//    }
}
